import React, { Component } from 'react'


export default class MultiSelect extends Component {
  constructor(props) {
    super(props)
    this.state = {
    }
  }

	toogleChange =(index)=>{
		console.log(index,12312312312)
		this.props.toogleChange(index)
	}
  
  render() {
    
    let arr = this.props.arr.map((item, index) => {
      return (
        <div key={item.id} id={item.id}>
          <p onClick={() => { this.toogleChange(item.id) }} style={{ background: this.props.activeIndex.indexOf(item.id)!=-1 ? "red" : "" }}>
            {item.value}
          </p>
        </div>

      )
    })
    return (
      <>
        <div className='list'>
          {arr}
        </div>
      </>
    )
  }
}

